const Router = require('koa-router');
const router = new Router();
const {db, QueryTypes} = require("../../models/db");
const tool = require("../../tools/tool"); const tools = require("../../tools/tool");

// 自动离店设置
router.post('/sets/setAutoLeft', async ctx => {
    let id = ctx.request.body.id
    let autoLeft = ctx.request.body.autoLeft
    await db.models['admin'].update({
        autoLeft: autoLeft
    }, {
        where: {
            id: id
        }
    })
    return ctx.suc(autoLeft === 1 ? '已设置自动离店' : '已取消自动离店')
})

module.exports = router;